<template>
  <div class="video">
    <div class="contain">
      <div class="title">
        <h3>
          <a-icon @click="fallBack" type="left" /><span class="word"
            >Mv详情</span
          >
        </h3>
      </div>
      <div class="wrap-mv">
        <video class="v" ref="video" :src="src" controls></video>
      </div>
    </div>
  </div>
</template>

<script>
import axios from "@/utils/axios";
export default {
  name: "Video",
  data() {
    return {
      src: "",
    };
  },
  methods: {
    fallBack() {
      this.$router.back();
    },
  },
  created() {
    const id = this.$route.params.id;
    axios.get("/mv/url", { params: { id } }).then((res) => {
      this.src = res.data.url;
      setTimeout(() => {
        this.$refs.video.play();
      }, 10);
    });
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.video {
  height: 60rem;
  background: #fff;
  padding: 2rem;
  .contain {
    width: 53rem;
    height: 40rem;
    .wrap-mv {
      padding: 1rem;
      padding-right: 2rem;
      width: 52rem;
      background: #008c8c;
      .v {
        width: 50rem;
        height: 37rem;
      }
    }
    .title {
      cursor: pointer;
      font-size: 1.9rem;
      .word {
        font-weight: bold;
        margin-left: 1rem;
      }
    }
  }
}
</style>